Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP等所有语言][Darabonba 2.0]rebuild retry policy && support retry for throttling e… #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yndu13
Copy link
Contributor

@yndu13 yndu13 commented Mar 20, 2024

…rror

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.84%. Comparing base (6b70aeb) to head (34f7657).
Report is 1 commits behind head on master.

❗ Current head 34f7657 differs from pull request most recent head 3a7a8c2. Consider uploading reports for the commit 3a7a8c2 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #145   +/-   ##
=======================================
  Coverage   53.84%   53.84%           
=======================================
  Files           1        1           
  Lines         455      455           
  Branches       94       94           
=======================================
  Hits          245      245           
  Misses        150      150           
  Partials       60       60           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yndu13 yndu13 changed the title [Darabonba 2.0]rebuild retry policy && support retry for throttling e… [WIP等所有语言][Darabonba 2.0]rebuild retry policy && support retry for throttling e… Mar 20, 2024
accessDeniedDetail = defaultAny(err.AccessDeniedDetail, err.accessDeniedDetail),
};
var code = defaultAny(err.Code, err.code);
if (Util.equalString(`${code}`, 'Throttling') || Util.equalString(`${code}`, 'Throttling.User') || Util.equalString(`${code}`, 'Throttling.Api')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以直接用 == 来判断字符串相等了

retryAfter = OpenApiUtil.getThrottlingTimeLeft(__response.headers),
requestId = `${requestId}`,
};
} else if (Util.is4xx(__response.statusCode)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里也可以用 statusCodeSample >= 400 && statusCodeSample < 500判断

accessDeniedDetail = defaultAny(err.AccessDeniedDetail, err.accessDeniedDetail),
};
var code = defaultAny(err.Code, err.code);
if (Util.equalString(`${code}`, 'Throttling') || Util.equalString(`${code}`, 'Throttling.User') || Util.equalString(`${code}`, 'Throttling.Api')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

retryAfter = OpenApiUtil.getThrottlingTimeLeft(__response.headers),
requestId = `${requestId}`,
};
} else if (Util.is4xx(__response.statusCode)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

description = `${defaultAny(err.Description, err.description)}`,
requestId = `${requestId}`,
};
}
}
if (Util.equalString(bodyType, 'binary')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

所有这些判断都改一下

@@ -542,14 +593,35 @@ api doROARequestWithForm(action: string, version: string, protocol: string, meth
if (Util.is4xx(__response.statusCode) || Util.is5xx(__response.statusCode)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改一下

};
var requestId = defaultAny(err.RequestId, err.requestId);
var code = defaultAny(err.Code, err.code);
if (Util.equalString(`${code}`, 'Throttling') || Util.equalString(`${code}`, 'Throttling.User') || Util.equalString(`${code}`, 'Throttling.Api')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

retryAfter = OpenApiUtil.getThrottlingTimeLeft(__response.headers),
requestId = `${requestId}`,
};
} else if (Util.is4xx(__response.statusCode)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

accessDeniedDetail = defaultAny(err.AccessDeniedDetail, err.accessDeniedDetail),
};
var requestId = defaultAny(err.RequestId, err.requestId);
var code = defaultAny(err.Code, err.code);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants